package com.relax.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.relax.service.OrderPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/serviceApi")
public class SentinelController {

    @Autowired
    private OrderPayService orderPayService;

    @GetMapping("/sentinel")
    @SentinelResource("SentinelController_annotation")
    public String orderPay(Integer userId) {
        return orderPayService.sentinelTest(userId, null);
    }

    @GetMapping("/sentinel_no")
    public String sentinel_no(Integer userId, Integer sleepTime) {
        return orderPayService.sentinelTest(userId, sleepTime);
    }

}
